<?php defined('SYSPATH') or die('No direct script access.');
/**
* Login Support
*/
class Helper_LoginSupport {
	
	static function &factory() {
	   $o = new Helper_LoginSupport();
	  return $o;	
	}
	
  // User Login
	public function login($username,$password)
	{
		$thesystems    = Helper_thesystems::factory();
		$check_storeid = $thesystems->system_auth('accounting_multistores');

		$loginquery = DB::select('id','nickname','userroles_key')
			->from('users')
			->where('nickname','=',$username)
			->where('hpassword','=',sha1($password))
			->execute();
		
		$loginresult['logid']			= $loginquery[0]['id'];
		$loginresult['logstatus']	= $loginquery[0]['userroles_key'];

		
		return $loginresult;
	}
	
  // Logout
	public function logout()
	{
		$ss = Session::instance();
		
		$ss->delete('logid');
		$ss->delete('logstatus');
	}
	
	
	
	
	
	
	
	
}




